Skip to content

Add Docker setup with PG and MCP servers#99

Merged
nicosuave merged 6 commits intomainfrom
nicosuave/docker-setup
Feb 21, 2026
Merged

Add Docker setup with PG and MCP servers#99
nicosuave merged 6 commits intomainfrom
nicosuave/docker-setup

Conversation

@nicosuave
Copy link
Copy Markdown
Member

Summary

Docker setup for sidemantic with a single container supporting multiple server modes. Includes PostgreSQL wire protocol server (for BI tools) and MCP server (for AI/LLM integration).

  • Dockerfile: Multi-stage build with all database drivers, 781MB runtime image
  • docker-entrypoint.sh: Mode control via SIDEMANTIC_MODE env var (serve/mcp/both)
  • CLI: --host flag on sidemantic serve for container networking (0.0.0.0)
  • CI: Docker workflow that builds, starts the server, and queries semantic layer metrics via psql
  • Docs: README section with usage examples and env var reference

- Dockerfile: Multi-stage build with all database drivers and optional dependencies (serve, mcp, all-databases). 781MB runtime image.
- docker-entrypoint.sh: Single container with SIDEMANTIC_MODE env var to control serve/mcp/both modes
- .dockerignore: Excludes unnecessary files for faster builds
- Add --host parameter to sidemantic serve CLI and config for container networking (0.0.0.0 support)
- README: Comprehensive Docker usage section with examples

Server fully tested: psql connections work, semantic layer tables queryable, demo mode verified.
Builds the image, starts the PG server in demo mode, and runs psql queries to verify semantic layer tables are accessible.
Replace passthrough SELECT * queries with GROUP BY queries that exercise
metric computation (product_count, avg_price, customer_count).
Pushes sidequery/sidemantic:latest and :version tags on main after
tests pass. Uses GHA build cache and buildx. Requires DOCKERHUB_USERNAME
and DOCKERHUB_TOKEN repo secrets.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83fac25c84

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

exec sidemantic serve --host 0.0.0.0 $ARGS $SERVE_ARGS "$@"
;;
mcp)
exec sidemantic mcp-serve $ARGS "$@"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop forwarding unsupported connection args to mcp-serve

In mcp mode (and also both mode), the entrypoint forwards $ARGS to sidemantic mcp-serve; when SIDEMANTIC_CONNECTION is set this injects --connection, but mcp_serve only accepts directory, --db, and --demo (sidemantic/cli.py), so startup fails with a CLI option error. This makes MCP/both container runs fail as soon as users configure a backend connection via environment variables.

Useful? React with 👍 / 👎.


case "$MODE" in
serve)
exec sidemantic serve --host 0.0.0.0 $ARGS $SERVE_ARGS "$@"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Quote entrypoint arguments to avoid shell splitting

The command expands $ARGS and $SERVE_ARGS unquoted, so values from environment variables are subject to shell word splitting and metacharacter handling; connection strings and credentials commonly contain characters like & or spaces, which can turn into broken/misaligned CLI arguments at runtime. This can make valid SIDEMANTIC_CONNECTION/auth values fail unpredictably in Docker deployments.

Useful? React with 👍 / 👎.

No longer triggers on every push/PR. Runs automatically after a
successful PyPI publish, or manually via workflow_dispatch.
Quote all env var expansions to handle special characters in connection
strings and credentials. Only pass --db to mcp-serve (it doesn't accept
--connection, --username, --password, or --port).
@nicosuave nicosuave merged commit 52f8728 into main Feb 21, 2026
15 checks passed
@nicosuave nicosuave deleted the nicosuave/docker-setup branch February 21, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant